Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D10 - Fatal error on empty group submission if configured as public group in settings #960

Open
wants to merge 1 commit into
base: 6.x
Choose a base branch
from

Conversation

jitendrapurohit
Copy link
Collaborator

Overview

Fatal error on empty group submission if configured as public group in settings

Before

To replicate

  • Create a webform with group = Public Group
  • Submit the form as anonymous user without enabling any options for the group field.
  • Error

Drupal\Core\Entity\EntityStorageException: 'public_groups' is not a valid option for field group_id in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 817 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

After

Fixed.

Technical Details

Unsetting $val works fine for logged-in or authorized users because it assigns it to $this->data only if the contact is logged in - https://github.com/colemanw/webform_civicrm/blob/6.x/src/WebformCivicrmPostProcess.php#L2579-L2583

For anonymous users, the key remains in $this->data, leading to an error. Removing it immediately fixes the error.

@petednz
Copy link

petednz commented Nov 19, 2024

Can you pls add a test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants